package com.chuan.thinkingjava.pattern.proxy;

import com.chuan.thinkingjava.pattern.proxy.impl.SayImpl;

public class SayProxy implements Say{

	private SayImpl sayImpl;
	
	private String msg;
	
	public SayProxy(String msg) {
		this.msg = msg;
	}
	
	@Override
	public void sayHello(String msg) {
		if (sayImpl == null) {
			sayImpl = new SayImpl();
		}
		sayImpl.sayHello(msg);
	}

}
